package com.hluck.goodweatherapp.viewmodel;

import androidx.lifecycle.MutableLiveData;

import com.hluck.goodweatherapp.data.bean.BingResponse;
import com.hluck.goodweatherapp.data.bean.Province;
import com.hluck.goodweatherapp.data.repository.BingRepository;
import com.hluck.goodweatherapp.data.repository.CityRepository;
import com.hluck.mvvmlibrary.base.BaseViewModel;

import java.util.List;

/**
 * @Author： LJH
 * @Time： 2024/1/4
 * @description：
 */
public class SplashViewModel extends BaseViewModel {
    public MutableLiveData<List<Province>> listMutableLiveData = new MutableLiveData<List<Province>>();
    public MutableLiveData<BingResponse> bingResponseMutableLiveData = new MutableLiveData<>();

    /**
     * 添加城市数据
     * @param cities
     */
    public void addCityData(List<Province> cities) {
        CityRepository.getInstance().addCityData(cities);
    }

    /**
     * 获取所有城市数据
     */
    public void getAllCities(){
        CityRepository.getInstance().getCityData(listMutableLiveData);
    }


    public void bing(){
        BingRepository.getInstance().bing(bingResponseMutableLiveData,failed);
    }
}
